#!/usr/bin/perl -w

#This takes in the value of ClientID from GetClientInfo.php (which originaly came 
#from testlog.php). It then compares this value with all the entries in client.txt
#If a match is found, the client's information is read and returned to GetClientInfo.php 

$clientID = $ARGV[0];
$a = 626;

open($file, "<", "../conf/client.txt") or die(exit(4));

while ($line = <$file>) {   # checks all lines in file

        if($line =~ /^\s*($clientID)                #Client id, must be found set to $1
			\s*\|\s*([[:alnum:]\s]*)    #Full name, may contain spaces set to $2
			\s*\|\s*(.*)                #ClientUploadRoot set to $3
			\|\s*(.*)                   #ClientDownloadRoot set to $4
			\|\s*(.*)                   #Bandwidth file path set to $5
			\|\s*(.*)                   #Drivespace file path set to $6
			\|\s*(.*)                   #Quota Username set to $7
			(\#.*)?$                    #End Comments
			/x) {

#Since we used the simple .* most of the values will need to be trimmed in php.


		if($1) { $a = 1; print $2."\n";
                           print $3."\n";
                           print $4."\n";
                           print $5."\n";
                           print $6."\n";
                           print $7."\n";}

               if ($a == 626) { print "ErrorCode626"; }
	}
}

close $file;

exit(5);
